﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Knowledgecast.Twitter
{
    public class UTCTimestampConverter
    {
        public static DateTime ConvertFromString(string strTimestamp)
        {
            DateTime timeStamp = DateTime.MinValue;
            if (strTimestamp != null)
            {
                string[] parts = strTimestamp.Split(' ');
                string month = parts[1];
                string dayOfMonth = parts[2];
                string strUtcTime = parts[3];
                string year = parts[5];

                timeStamp = DateTime.Parse(month + " " + dayOfMonth + ", " + year + " " + strUtcTime, null, System.Globalization.DateTimeStyles.AssumeUniversal);
                return timeStamp.ToLocalTime();
            }

            return timeStamp;
        }
    }
}
